package com.lanca.controller;

import com.lanca.feignclient.HystrixClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Autowired
    private HystrixClient hystrixClient;

    /**
     * 说明：当hystrix服务在时，就用hystrix的熔断处理机制，
     * 若hystrix宕机了，则用HystrixClientFallBack里面的处理方法
     *
     * @return String
     */
    @GetMapping("/test")
    public String test() {
        String demo = hystrixClient.demo(-1);
        return demo;
    }
}
